Variations on a^n b^n
We saw in class that A=\{a^nb^n \mid n\in \mathbb N\} is not a regular language.
Consider now a language L\subseteq A. Show that L is regular if and only if L is finite.
HintBefore proving the general result it might be easier to prove the special cases to get ideas on how to proceed in general.
- How would you show that \{a^nb^n \mid n\in 2\mathbb N\} is not regular?
- How would you show it with \{a^nb^n \mid n\in 3\mathbb N\}?
Show that the following languages are not regular.
- \{a^nb^m \mid n,m\in \mathbb N\land n\leq m\}
- \{a^nb^m \mid n,m\in \mathbb N\land n\geq m\}
- \{a^nb^m \mid n,m\in \mathbb N\land n\neq m\}
- \{a^{2n}b^n \mid n\in 2\mathbb N\}
HintUsing the pumping lemma directly is doable but a bit tricky. It is simpler to use first closure properties of regular languages.
Show that the following languages over \{a,b,c\} are not regular.
- \{c^ma^nb^n \mid n,m\in \mathbb N\}
- \{a^nc^mb^n \mid n,m\in \mathbb N\}
- \{a^nb^nc^m \mid n,m\in \mathbb N\}
- \{a,b\}^* \cup \{c^ma^nb^n \mid n,m\in \mathbb N\}
Show that the Dyck language is not regular, that is the language of all well-balanced parentheses is not regular. More precisely, given the alphabet \Sigma=\{(,)\}, show that the language \{w\in \Sigma^* \mid |w|_(=|w|_) \land \text{for every prefix $u$ of $w$} \ \ |u|_(\geq |u|_)\}
is not regular.